import 'package:flutter/material.dart';
import 'package:twopaiflutter/PushReplacementNamedPage.dart';
import 'package:twopaiflutter/route.dart';
import 'package:twopaiflutter/seoondpage.dart';
import 'package:twopaiflutter/text.dart';
import 'package:twopaiflutter/container.dart';
import 'package:twopaiflutter/row.dart';
import 'package:twopaiflutter/align.dart';
import 'package:twopaiflutter/fittedbox_aspectratio_constrainedbox.dart';
import 'package:twopaiflutter/LimitedBox_Offstage_OverflowBox_SizedBox.dart';
import 'package:twopaiflutter/Stack_IndexedStack_GridView.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {


  @override
  Widget build(BuildContext context) {

    // TODO: implement build
    return new MaterialApp(
      debugShowCheckedModeBanner: false,
      color: Colors.white,
      title: "回旋福努特",//按home键打开多任务窗口时看到的应用名字
      theme: ThemeData(
        brightness: Brightness.light,
        iconTheme:new IconThemeData() ,
        primarySwatch: Colors.blue,
        primaryColor: Colors.lightBlue[800],
        accentColor: Colors.cyan[600],
      ),
      home:new Scaffold( //避免黑色背景
        body: new RoutePage(),
      ),
      routes:<String, WidgetBuilder>{
        "/route":(_)=>new RoutePage(),//路由
        "/pushReplacementNamedPage":(_)=>new PushReplacementNamedPage(),
        "_SecondPageSate":(_)=>new SecondPage(""),


        "/text":(_)=>new TextPage(),//注册路由
        "/container":(_)=>new ContainerPage(),
        "/row":(_)=>new RowPage(),
        "/fittedbox_aspectratio_constrainedbox":(_)=>new Fittedbox_aspectratio_constrainedbox(),
        "/LimitedBox_Offstage_OverflowBox_SizedBox":(_)=>new LimitedBox_Offstage_OverflowBox_SizedBox(),
        "/Stack_IndexedStack_GridView":(_)=>new Stack_IndexedStack_GridView(),
      } ,
//      new Container(
//
//        child: new Text(
//          "回旋福努特\n凡事看你的发送卡",
//          style: TextStyle(
//              letterSpacing: 1,
//              wordSpacing: 1,
//              fontSize: 14,
//              background:bg,//文本框背景色
//              decoration: TextDecoration.none//不加默认TextDecoration.underline
//          ),
//        ),//黑色背景
//      )
    );
  }

}

class HomePage extends StatefulWidget{
  @override
  State<StatefulWidget> createState() {
    // TODO: implement createState
    return new HomePageState();
  }
}

class HomePageState extends State<HomePage> with SingleTickerProviderStateMixin{
  @override
  Widget build(BuildContext context) {
    Paint bg=new Paint();
    bg.color=Colors.blue;
//    Navigator.of(context).pushNamed("/text.dart");
    // TODO: implement build
    return new Center(
        child:new FlatButton(
          padding: EdgeInsets.fromLTRB(50, 15, 50, 15),
            child:  new Text(
              "go",
              style: new TextStyle(
                decoration: TextDecoration.none,
                background: bg,
              ),
            ),
            onPressed: goPage//==>void goPage()
        )
    );
  }

  goPage() {
     Navigator.pushNamed(context, "/Stack_IndexedStack_GridView");
  }


}